package smashedapples.forms
{
	import mx.controls.CheckBox;

	public class CheckBox extends mx.controls.CheckBox implements IFormControl
	{
		public function CheckBox()
		{
			super();
		}

		[Inspectable( category="General" )]
		/**
		 *  An array of possible true/false values where the first value represents being selected.
		 *  Default is [1,0]
		 *
		 *  [Y,N],[1,0],[T,F],[True,False]
		 */
		public var values:Array = [ 1, 0 ];

		public function get cProperty():String
		{
			return "selected";
		}

		public function set cProperty( cProperty:String ):void
		{
			//checkboxes are different so we don't allow this to be set;
		}

		private var _cName:String;

		public function get cName():String
		{
			if( _cName != null )
				return _cName;
			return this.id as String;
		}

		public function set cName( value:String ):void
		{
			_cName = value;
		}

		private var _cInclude:Boolean = true;

		public function get cInclude():Boolean
		{
			return _cInclude;
		}

		public function set cInclude( value:Boolean ):void
		{
			_cInclude = value;
		}



		public function get cValue():*
		{
			if( this.selected == true )
			{
				return values[ 0 ];
			}

			return values[ 1 ];
		}

		[Bindable( name="selectedChanged" )]
		public function set cValue( value:* ):void
		{
			if( value == values[ 0 ])
			{
				this.selected = true;
			}
			else
			{
				this.selected = false;
			}
		}


		public function cReset():void
		{
			this.cValue = this.cDefault;
		}

		private var _cDefault:*;

		public function get cDefault():*
		{

		}

		public function set cDefault( value:* ):void
		{

		}

		private var _cCache:Boolean = false;

		public function get cCache():Boolean
		{
			return _cCache;
		}

		public function set cCache( value:Boolean ):void
		{
			_cCache = value;
		}




	}
}